/*
* $Id: StringFunction.java 230 2010-12-27 23:20:16Z volok-aleksej@yandex.ru $
*
* Copyright 2008-2010 by Volokitin Alexey
* All rights reserved
*
*/
package apiary.common;

import java.util.Vector;

/**
 * Helper functions for string manipulation
 * @author lexus
 */
public class StringFunction {
    /**
     * Splits a string into words
     * @param source source string
     * @return list of words
     */
    public static Vector GetWords(String source){
        Vector words = new Vector();
        int pos = 0, posEnd = 0;
        posEnd = source.indexOf(' ', pos);
        while (posEnd != -1){
            words.addElement(source.substring(pos, posEnd));
            pos = posEnd + 1;
            posEnd = source.indexOf(' ', pos);
        }
        words.addElement(source.substring(pos, source.length()));
        return words;
    }
}
